package com.bsoft.apiservice.web;

import com.bsoft.apiservice.dto.*;
import com.bsoft.apiservice.service.SpecimenTransportService;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/specimen")
public class SpecimenTransportController {

    @Autowired
    private SpecimenTransportService specimenTransportService;

    @PostMapping("/createOrder")
    public ApiResponse createSpecimenOrder(@RequestBody PackageReq request) throws JsonProcessingException {
        // 校验Authorization
    /*    if (!specimenTransportService.validateAuthorization(requestId, from, authorization)) {
            return new ApiResponse("401", "Unauthorized", null);
        }
*/
        // 调用服务层处理逻辑
        return specimenTransportService.createSpecimenOrder(request);
    }

    @PostMapping("/cancelOrder")
    public ApiResponse cancelSpecimenOrder( @RequestBody CancelOrderRequest request) {
        // 校验Authorization
 /*       if (!specimenTransportService.validateAuthorization(requestId, from, authorization)) {
            return new ApiResponse("401", "Unauthorized", null);
        }
*/
        // 调用服务层处理逻辑
        return specimenTransportService.cancelSpecimenOrder(request);
    }


}